<?php
$client = new \Swoole\Client(SWOOLE_SOCK_TCP,SWOOLE_SOCK_ASYNC);
$client->on('connect', function ($cli) {
   echo "connect======".PHP_EOL;
    $cli->send("aaa");
});

$client->on('receive', function ($cli, $data) {
    echo "receive======".PHP_EOL;
    //判断当前客户端是否已与服务端建立了连接
    var_dump($cli->isConnected());
    //暂时停止接收数据，调用后将从事件循环中移出，不再触发数据接收事件，除非调用 wakeup() 方法恢复。
});

$client->on("error", function ($cli) {
    echo "error======".PHP_EOL;
});

$client->on("close", function ($cli) {
   echo "close======".PHP_EOL;
});

$client->connect('127.0.0.1',3333);